import i18n from '@/lang'
import Vue from "vue";
export const typeList = [
  { key: 'differentialPackage', value: '20' },
  { key: 'wholePackage', value: '10' }
]
// 表头
export const columns = [
  {
    title: i18n.t('partNumber'),//ECU ID
    key: 'partNumber',
    scopedSlots: { customRender: 'partNumber' },
    // fixed: 'left',
    width: 140
  },
  {
    title: i18n.t('versionType'),//版本类型
    dataIndex: 'versionType',
    width: 130,
    customRender: (text, record, index) => {
      if(record.formType==='AUTO'){
        return text='自动测试版'
      }
      return Vue.$store.getters.getDictCodeObj('versionTypeDictCode')[text] || text;
    },
  },
  {
      title: '车型',
      width: 160,
      key: 'modelCode',
      scopedSlots: { customRender: 'modelCode' }
  },
  {
    title: i18n.t('partName'),//ECU名称
    key: 'partName',
    scopedSlots: { customRender: 'partName' },
    // fixed: 'left',
    width: 140
  },
  {
    title: i18n.t('softwareCoding'),//软件编码
    dataIndex: 'softwareCode',
    width: 140,
    scopedSlots: { customRender: 'softwareCode' }
  },
  {
    title: i18n.t('versionName'),//版本号
    dataIndex: 'name',
    width: 140,
    scopedSlots: { customRender: 'versionName' }
  },
  /*  {
    title: i18n.t('versionCode'),//版本编号
    dataIndex: 'code',
    width: 120,
    scopedSlots: { customRender: 'versionCode' }
  }, */
 /*  {
    title: i18n.t('hardVersion'),//硬件版本
    dataIndex: 'hardVersion',
    width: 120,
    scopedSlots: { customRender: 'hardVersion' }
  }, */
  /* {
    title: i18n.t('hardVersionDate'),//硬件日期
    dataIndex: 'hardVersionDate',
    width: 120,
    scopedSlots: { customRender: 'hardVersionDate' }
  }, */
  {
    title: i18n.t('dependencyVersion'),//兼容版本
    dataIndex: 'dependenceVersion',
    width: 120,
    scopedSlots: { customRender: 'dependenceVersion' }
  },
  {
    title: i18n.t('wholePackage'),//全包
    width: 120,
    key: 'wholePackage',
    scopedSlots: { customRender: 'wholePackage' }
  },
  {
    title: i18n.t('differentialNum'),//差分包数量
    width: 120,
    key: 'differentialNum',
    scopedSlots: { customRender: 'differentialNum' }
  },
  /* {
    title: i18n.t('configFileVersion'),//配置文件版本
    dataIndex: 'configVersionName',
    width: 120,
    scopedSlots: { customRender: 'configFileVersion' }
  }, */
  {
    title: '表单类型',
    dataIndex: 'formType',
    width: 120,
     scopedSlots: { customRender: 'formType' } 
  }, 
  {
    title: i18n.t('timeOfCreation'),//创建时间
    dataIndex: 'createTime',
    width: 160,
    sorter: true,
    scopedSlots: { customRender: 'createTime' }
  },
  {
    title: 'SVN日期',
    dataIndex: 'svnDate',
    width: 120,
  scopedSlots: { customRender: 'svnDate' } 
  }, 
  /* {
    title: i18n.t('creator'),//创建人
    dataIndex: 'createBy',
    width: 100,
    scopedSlots: { customRender: 'creator' }
  }, */
  {
    title: i18n.t('operation'),//操作
    dataIndex: 'action',
    width: 260,
    scopedSlots: { customRender: 'action' },
    fixed: 'right'
  }
]
export const fileConfigurationColumns = [
  {
    title: i18n.t('fileName'),//文件名称
    key: 'fileName',
    scopedSlots: { customRender: 'packageName' },
    width: 200
  },
  {
    title: i18n.t('fileSize'),//文件大小
    key: 'fileSize',
    scopedSlots: { customRender: 'strSize' },
    width: 100
  },
  {
    title: i18n.t('fileStatus'),
    key: 'fileStatus',
    width: 150,
    scopedSlots: { customRender: 'fileStatus' }
  },
  {
    title: i18n.t('fileProcess'),//文件进度
    dataIndex: 'process',
    width: 160,
    scopedSlots: { customRender: 'fileProcess' }
  },
  {
    title: i18n.t('uploadTime'),//上传时间
    dataIndex: 'createTime',
    width: 160,
    scopedSlots: { customRender: 'uploadTime' }
  },
  // {
  //   title: i18n.t('fileType'),//文件类型
  //   key: 'fileType',
  //   width: 120,
  //   scopedSlots: { customRender: 'fileType' }
  // },
  {
    title: i18n.t('originalVersion'),//原始版本
    key: 'originalVersion',
    width: 120,
    scopedSlots: { customRender: 'sourceVersion' }
  },
  {
    title: i18n.t('versionType'),//版本类型
    //使用源版本的类型，不用resource 的versionPhase
    dataIndex: 'versionPhase',
    width: 130,
    customRender: (text, record, index) => {
      return Vue.$store.getters.getDictCodeObj('versionTypeDictCode')[text] || text;
    },
  },
  {
    title: i18n.t('estimatedInstallTime') + '(s)',//预计安装时间
    dataIndex: 'installTime',
    scopedSlots: { customRender: 'installTime' },
    width: 140
  },
  {
    title: i18n.t('timeout') + '(s)',//超时时长
    dataIndex: 'overTime',
    width: 120,
    scopedSlots: { customRender: 'overTime' }
  },
  // {
  //   title: i18n.t('file') + i18n.t('sxType'),//文件烧写类型
  //   dataIndex: 'dllName',
  //   width: 120,
  //   scopedSlots: { customRender: 'dllName' }
  // },
  {
    title: i18n.t('zysf'),//摘要算法
    key: 'zysf',
    width: 120,
    scopedSlots: { customRender: 'zysf' }
  },
  {
    title: i18n.t('zyz'),//摘要值
    key: 'zyz',
    width: 120,
    scopedSlots: { customRender: 'zyz' }
  },
  {
    title: i18n.t('softFormNo'),//软件管控表单编号
    dataIndex: 'softFormNo',
    width: 150,
  },
]
export const processFileColums = [
  {
    title: i18n.t('operation'),//操作
    dataIndex: 'process',
    scopedSlots: { customRender: 'operation' },
    width: 120
  },
  {
    title: i18n.t('result'),//结果
    dataIndex: 'status',
    scopedSlots: { customRender: 'result' },
    width: 60
  },
  {
    title: i18n.t('actionStartTime'),//操作开始时间
    dataIndex: 'startTime',
    scopedSlots: { customRender: 'actionStartTime' },
    width: 120
  },
  {
    title: i18n.t('actionEndTime'),//操作结束时间
    dataIndex: 'endTime',
    scopedSlots: { customRender: 'actionEndTime' },
    width: 120
  }

]
export const TargetVersionColums = [
  {
    title: i18n.t('版本号'),
    dataIndex: 'sourceVersionName',
    scopedSlots: { customRender: 'sourceVersionName' },
    width: 120
  },
  {
    title: i18n.t('版本类型'),
    dataIndex: 'versionPhase',
    scopedSlots: { customRender: 'versionPhase' },
    customRender: (text, record, index) => {
      if (text === 'TEST') {
        return '测试版'
      } else if (text === 'PROD') {
        return '定版'
      } else {
        return '-'
      }
    },
    width: 120
  },
  {
    title: i18n.t('车型代码'),
    dataIndex: 'modelCode',
    scopedSlots: { customRender: 'modelCode' },
    width: 120
  },
  {
    title: i18n.t('车型名称'),
    dataIndex: 'modelName',
    scopedSlots: { customRender: 'modelName' },
    width: 120
  },
  {
    title: i18n.t('ECU名称'),
    dataIndex: 'ecuName',
    scopedSlots: { customRender: 'ecuName' },
    width: 120
  }
]
export const RawVersionColums = [
  {
    title: i18n.t('版本号'),
    dataIndex: 'sourceVersionName',
    scopedSlots: { customRender: 'sourceVersionName' },
    width: 120
  },
  {
    title: i18n.t('软件包名称'),
    dataIndex: 'resourceName',
    scopedSlots: { customRender: 'resourceName' },
    width: 200
  },
  {
    title: i18n.t('版本类型'),
    dataIndex: 'versionPhase',
    scopedSlots: { customRender: 'versionPhase' },
    customRender: (text, record, index) => {
      if (text === 'TEST') {
        return '测试版'
      } else if (text === 'PROD') {
        return '定版'
      } else {
        return '-'
      }
    },
    width: 120
  },
  {
    title: i18n.t('车型代码'),
    dataIndex: 'modelCode',
    scopedSlots: { customRender: 'modelCode' },
    width: 120
  },
  {
    title: i18n.t('车型名称'),
    dataIndex: 'modelName',
    scopedSlots: { customRender: 'modelName' },
    width: 120
  },
  {
    title: i18n.t('ECU名称'),
    dataIndex: 'ecuName',
    scopedSlots: { customRender: 'ecuName' },
    width: 120
  }
]
